        <%--
  Created by IntelliJ IDEA.
  User: 78733
  Date: 2019/4/16
  Time: 23:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>首页</title>
</head>
<body>
    <% HttpSession httpSession = request.getSession();
        if (httpSession.getAttribute("username") == null) {
    %>
    <a href="https://cas.dgut.edu.cn?appid=javaee&state=STATE">
        <button>登录</button>
    </a>

    <%} else {%>
    <a href="https://cas.dgut.edu.cn/logout?callback=CALLBACK">
        <button>退出</button>
    </a>

    <%
        if (httpSession.getAttribute("username")!= null) {
            String username = (String) httpSession.getAttribute("username");
            String name = (String) httpSession.getAttribute("name");
            String group = (String) httpSession.getAttribute("group");
            String openid = (String) httpSession.getAttribute("openid");
            String wx_openid = (String) httpSession.getAttribute("wx_openid");
    %>
    <table border="1" align="center">
        <tr bgcolor="#949494">
            <th>用户信息</th>
            <th>值</th>
        </tr>
        <tr>
            <td>用户名</td>
            <td><%out.print(username);%></td>
        </tr>
        <tr>
            <td>所属组</td>
            <td><% out.print(name); %></td>
        </tr>
        <tr>
            <td>openid</td>
            <td><% out.print(openid); %></td>
        </tr>
        <tr>
            <td>wx_oennid</td>
            <td><% out.print(wx_openid); %></td>
        </tr>
    </table>

    <%}%>
<%}%>

</body>
</html>
